package edu.chen.enums;

public enum BasicStateEnum implements BasicEnum{
    SUCCESS(1,"操作成功"), FAILURE(-0,"操作失败"), INNER_ERROR(-1,"系统异常");

    private int state;
    private String stateInfo;

    BasicStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public static BasicStateEnum stateOf(int index){
        for (BasicStateEnum stateEnum : values()){
            if(stateEnum.getState()  == index)
                return stateEnum;
        }
        return null;
    }

}
